const express = require('express');
const app = express();

app.get('/index',(req, res) => {
    // 获取query参数
    let {a, b} = req.query;
    console.log('query参数', a, b);
}) 
app.get('/user/:id/:name',(req, res) => {
    // 获取params参数
    let {id,name} = req.params;
    console.log('params参数',id, name);
}) 
app.post('/index/:id',(req, res) => {
    // 获取body参数
    let result = req.body;
    let {id} = req.params;
    console.log('body参数', result); //undefined
    console.log('post里的params参数',id);
})
app.listen('8989', () => {
    console.log('服务已启动，http://localhost:8989');
})